import request from "@/utils/request";

// 查询部门列表
export function listDept(query) {
  return request({
    url: "/v1/system/dept/list",
    method: "get",
    params: query,
  });
}

// 查询部门列表
export function allDept(query) {
  return request({
    url: "/v1/system/dept/all",
    method: "get",
    params: query,
  });
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild(dept_id) {
  return request({
    url: "/v1/system/dept/exclude",
    method: "get",
    params: { dept_id },
  });
}

// 查询部门详细
export function getDept(dept_id) {
  return request({
    url: "/v1/system/dept/getById",
    method: "get",
    params: { dept_id },
  });
}

// 新增部门
export function addDept(data) {
  return request({
    url: "/v1/system/dept/add",
    method: "post",
    data: data,
  });
}

// 修改部门
export function updateDept(data) {
  return request({
    url: "/v1/system/dept/update",
    method: "put",
    data: data,
  });
}

// 删除部门
export function delDept(dept_id) {
  return request({
    url: "/v1/system/dept/delete",
    method: "post",
    data: { dept_id },
  });
}

// 删除部门
export function delDeptByIds(ids) {
  return request({
    url: "/v1/system/dept/deleteByIds",
    method: "post",
    data: { ids },
  });
}
